package com.hundsun.s3.platform.backstage.service.Impl;

import org.springframework.stereotype.Service;

import com.hundsun.s3.common.dto.PageBean;
import com.hundsun.s3.common.dto.Performence;
import com.hundsun.s3.common.util.BaseDao;
import com.hundsun.s3.platform.backstage.common.util.ChartUtils;
import com.hundsun.s3.platform.service.PerformenceService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

/**
 * com.hundsun.s3.platform.backstage.service.Impl
 *
 * @Description:
 * @Author: yangjun23614
 * @Date: Created in 10:02 2018/3/6
 * V1.0 10:02 2018/3/6
 */
@Service
public class PerformenceServiceImpl extends BaseDao implements PerformenceService{

    static Logger logger = Logger.getLogger(PerformenceServiceImpl.class.getName());

    @Override
    public int performenceCountQryByMonth(String find_performence ){
        int[] count = new int[1];
        Map<String, Object> params = new HashMap<>();
        params.put("find_performence",find_performence );
        List<Map<String, String>> list = this.call("400023",params);
        ChartUtils.getValuesInListMap(list,count);
        return count[0];
    }
    /**
     * @Description: 查询绩效表
     * @param: [find_performence]
     * @return:  
     * @Author: yangjun23614
     * @Date: 10:22 2018/3/6
     * V1.0 
     */
    @Override
    public Map<String,Object> performenceQryByMonth(String find_performence, PageBean pageBean) {
        pageBean.setCount(this.performenceCountQryByMonth(find_performence));
        Map<String,Object> params = new HashMap<>();
        params.put("find_performence",Integer.parseInt(find_performence));
        params.put("first_record",pageBean.getStart());
        params.put("last_record",pageBean.getEnd());
        List<Performence> list = this.qry("400020",params, Performence.class);
        Map<String,Object> map = new HashMap<>();
        map.put("list",list);
        map.put("page",pageBean);
        return map;
    }

    /**
     * @Description:
     * @param: 
     * @return:  
     * @Author: yangjun23614
     * @Date: 15:48 2018/3/08
     * V1.0 
     */
    @Override
    public Map<String,Object> performenceQryByParams(Map<String,Object> params, String functionId) {
        List<Performence> list = this.qry(functionId,params, Performence.class);
        Map<String,Object> map = new HashMap<>();
        map.put("list",list);
        return map;
    }

    /**
     * @Description:
     * @param: 
     * @return:  
     * @Author: yangjun23614
     * @Date: 15:49 2018/3/08
     * V1.0 
     */
    @Override
    public int performenceCountQryByParams(Map<String,Object> params, String functionId){
        int[] count = new int[1];
        List<Map<String, String>> list = this.call(functionId,params);
        ChartUtils.getValuesInListMap(list,count);
        return count[0];
    }
}
